package test.concurrent.test;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author: James.H.Fu
 * @description:
 * @date: Created in 19:54 2018-05-16
 * @modified By:
 */
public abstract class BaseTask {
    private Logger logger = LoggerFactory.getLogger(getClass());

    protected void runTask(String businessName, TaskProcedure taskProcedure) {
        logger.info("开始执行{}", businessName);
        try {
            taskProcedure.run();
        } catch (Exception ex) {
            logger.error("{}异常。", businessName, ex);
        }
        logger.info("结束执行{}", businessName);
    }
}
